#list
#
# d<-"our one list "
#
# d1<-c(1,2,4,7,9)
#
# d2<-matrix(c(2,4,6,8),2,2,byrow=T)
#
# ourlist<-list(d,d1,d2)
#
# mode(ourlist)
#
#
# ourlist2<-list()          #建立或声明一个空向量
# mode(ourlist2)        #查看一下类型，返回结果是列表
#
#
#
# d<-"our one list "
# d1<-c(1,2,4,7,9)
# d2<-matrix(c(2,4,6,8),2,2,byrow=T)
# d3<-list(c(1,2),c(3,4))      #列表
#
# ourlist3<-list("字符"=d,d1 = d1,juzhen = d2,d3)
#
#
# listxx<-list(d3=c(2,4,6,8),d4=c(1,3,5,7))
#
#
# listxx
#
# unname(listxx)
#
#
# listxx1<-list(d5=c(2,4,6,8),d6=c(1,3,5,7))
#
# names(listxx1)<-NULL
#
# listxx2<-list(D1=c(2,4,6,8),D2=c(1,3,5,7))
#
# names(listxx2)<-c("f1","f2")
#
#
# for(i in c(1:length(ourlist))){
#   print(ourlist3[i]);
# }
#
# ourlist3["字符"]
#
# ourlist5<-list(a=c(1,2),b=c(3,5),c(5,6))
#
#
# ourlist6<-list(a=c(1,2),b=c(3,5))
#
# ourlist6[[3]]<-TRUE
#
# ourlist7<-list(a=c("很好","非常好"),b=c("good","nice"))
#
# ourlist7$c <- "你好"
#
# ourlist7$d <- NULL
#
#
# ourlist8<-list(a=c("很好","非常好"),b=c("good","nice"))
#
# ourlist9<-ourlist8[-2]
#
# ourlist8<-list(a=c("很好","非常好"),b=c("good","nice"))
#
# listaa1<-list(a1=c(1,3,5,7,9),a2=c(2,4,6,8,10))
#
# lapply(listaa1,mean)
#
# lapply(listaa1,max)   #返回组件内容中的最大值
#
# sapply(listaa1,mean)   #返回结果是向量，标签与返回值竖一一对应
#
# mydata2<-data.frame(name=c("李小华","张大三","李佳怡"),"性别"=c("男","男","女"),age=c(18,19,20))
#
# higth<-c(175,173,167)   #这里创建了一个身高的向量
#
# a<-data.frame(name="X","性别"="男",age=21,higth=177)  #要加入的新数据框
#
#
# mydata4<-mydata2[-2,]    #删掉第二行
#
# mydata5<-mydata2[,-1]    #删掉第一列
#
# mydata6<-mydata2

mydata9<-data.frame("c1"=c(1,2,3),"c2"=c(6,7,8),"c3"=c(11,12,13),"c4"=c(4,5,6))

r_mean<-apply(mydata9,1,mean)  #对行求均值

da<-cbind(mydata9,r_mean)


r_mean1<-apply(mydata9,2,mean)  #对列求均值

da<-rbind(da,r_mean1)

rownames(da)<-c("r1","r2","r3","c_mean")    #改一下行名
da[4,"r_mean"]<-NA

mydata10<-da

rm(da)



